//导入封装好的axios(封装好的ajax) -request
import request from '@/utils/request'

/**
 * 定义接口
 */
export default {
  /**
   * 1.讲师列表（条件分页查询）
   * @param pageNo
   * @param limit
   * @param teacherQuery
   * @returns {*}
   */
  getTeacherListPage(pageNo, limit, teacherQuery) {
    return request({
      // 请求地址
      url: `/edu/teacher/pageListTeacherCondition/${pageNo}/${limit}`,
      method: 'post',
      // teacherQuery为条件对象,后端采用了@RequesBody获取数据
      // data 把对象转换为json进行传递到后端
      data: teacherQuery
    })
  },
  /**
   * 根据id删除讲师
   * @param id 讲师id
   * @returns {*}
   */
  deleteTeacherById(id) {
    return request({
      //请求地址
      url: `/edu/teacher/${id}`,
      method: 'delete'
    })
  },
  /**
   * 添加讲师
   * @returns {*}
   */
  addTeacher(teacher) {
    return request({
      url: '/edu/teacher/save',
      method: 'post',
      data: teacher
    })
  },
  /**
   * 修改讲师信息
   * @param teacher
   * @returns {*}
   */
  updateTeacherInfo(teacher) {
    return request({
      url: '/edu/teacher/updateTeacher',
      method: 'post',
      data: teacher,
    })
  },
  /**
   * 根据讲师id查询讲师信息
   * @param id
   * @returns {*}
   */
  getTeacherInfo(id) {
    return request({
      url: `/edu/teacher/${id}`,
      method: 'get'
    })
  },


}
